import { queryTariffList } from '@/services/common';

export default {
  code: '柜体编号',
  bluetoothName: '蓝牙名称',
  gardenId: '小区(学校)',
  name: '柜体名称',
  addr: '短线地址',
  logisId: '物流中心',
  hwareVersion: '硬件版本',
  iotImei: 'IMEI编号',
  longitude: '经度',
  structVersion: '结构版本',
  iotInitStatus: 'IMEI状态',
  latitude: '纬度',
  circuitVersion: '电路版本',
  isSaveOrder: '柜体储存订单',
  hasKeyboard: '柜体键盘',
  detentionDay: '滞留时间阈值',
  pushPlatform: 'PUSH类型',
  hasScreen: '柜体屏幕',
  detentionMax: '滞留个数阈值',
  managerUid: '运维人员',
  managerName: '运维人员',
  managerPhone: '运维电话',
  netType: '网络类型',
  firmVersion: '固件版本',
  sysVersion: '系统版本',
  booterVersion: 'Booter APK版本',
  softVersion: 'UI APK版本',
  scannerSid: '扫码器序列号',
  isLetterEnabled: '信报箱',
  resolution: '分辨率',
  openCodeType: '取件密码类型',
  isOpenAppointment: '格口预约状态',
  retentionLength: '预约保留时间',
  scanConfirm: '扫码确认柜体编号',
  currentSelectedCode: '格口使用编码',
  tariffpkgId: '套餐',
  isDepositEnabled: '柜体寄存',
  payMaskStr: '可用付费方',
  status: '柜体状态',
  bluetoothMac: '蓝牙地址',
  isCabDeliEnabled: '柜体投递功能',
  layout: '副柜数量(左-右)',
  slaveInfo: '副柜信息',
  cabSendingEnabled: '校园寄件',
  deviceId: '柜体唯一标识',
  verifyTime: '偏差时间',
};


/**
 * 转换为中文
 */
export const checkParams = (name: string, value: any) => {
  const booleanInfo = { // 布尔类型
    isSaveOrder: { 0: '不储存', 1: '储存' },
    hasKeyboard: { 0: '无', 1: '有' },
    hasScreen: { 0: '无', 1: '有' },
    isLetterEnabled: { 0: '禁用', 1: '启用' },
    isOpenAppointment: { 0: '禁用', 1: '启用' },
    scanConfirm: { 0: '关闭', 1: '开启' },
    currentSelectedCode: { 0: '默认', 1: '旧编码', 2: '新编码' },
    isDepositEnabled: { 0: '禁用', 1: '启用' },
    status: { 1: '调试中', 2: '运营中' },
    isCabDeliEnabled: { 0: '禁用', 1: '启用' },
    cabSendingEnabled: { 0: '禁用', 1: '启用' },
    openCodeType: { 0: '无', 1: '6位字母和数字', 2: '8位纯数字' },
  };
  const payMaskStr = { 1: '投递人付费', 2: '用户付费' };
  let turnVal = value || '无';
  if (name === 'payMaskStr' && value) {
    turnVal = value.split(',').map((item: string) => payMaskStr[item]).join(',');
  }
  const keysArray = Object.keys(booleanInfo);
  return keysArray.indexOf(name) >= 0
    ? booleanInfo[name][Number(value)] : turnVal;
};
